#include "TraceDebug.h"
#include <iostream>
extern void TestUtils(void);
extern void TestCmdExecuter();
extern void TestUpgrader();
extern void TestMsgQueue();
extern void TestEvent();
extern void TestThread();
extern void TestTimer(void);
extern void TestTcp(void);
extern void TestUdp(void);
extern void TestRingBuffer();
extern void TestSetting();
extern void TestComPort();
extern void TestNetwork();
extern void TestDataBase();
extern void TestTask();
extern void TestHttpClient();
extern void TestJSON(void);

static void print_menu()
{
    TRACE_YELLOW("==========run test program===========\n");
    TRACE_YELLOW("quit/q ---> quit test program.\n");
    TRACE_YELLOW("01 ---> MsgQueue test.\n");
    TRACE_YELLOW("02 ---> Event test.\n");
    TRACE_YELLOW("03 ---> Thread test.\n");
    TRACE_YELLOW("04 ---> Timer test.\n");
    TRACE_YELLOW("05 ---> TcpSocket test.\n");
    TRACE_YELLOW("06 ---> UcpSocket test.\n");
    TRACE_YELLOW("07 ---> Utils test.\n");
    TRACE_YELLOW("08 ---> CmdExecuter test.\n");
    TRACE_YELLOW("09 ---> RingBuffer test.\n");
    TRACE_YELLOW("10 ---> Setting test.\n");
    TRACE_YELLOW("11 ---> ComPort test.\n");
    TRACE_YELLOW("12 ---> Network test.\n");
    TRACE_YELLOW("13 ---> DataBase test.\n");
    TRACE_YELLOW("14 ---> Task test.\n");
    TRACE_YELLOW("15 ---> HttpClient test.\n");
    TRACE_YELLOW("16 ---> JSONData test.\n");
    TRACE_YELLOW("=====================================\n");
}

void testMain()
{
    std::string inputStr;
    while (1)
    {
        print_menu();
        std::cin >> inputStr;
        std::cout << inputStr << std::endl;
        if ("q" == inputStr || "quit" == inputStr) return;
        else if ("01" == inputStr)	TestMsgQueue();
        else if ("02" == inputStr)	TestEvent();
        else if ("03" == inputStr)	TestThread();
        else if ("04" == inputStr)	TestTimer();
        else if ("05" == inputStr)	TestTcp();
        else if ("06" == inputStr)	TestUdp();
        else if ("07" == inputStr)	TestUtils();
        else if ("08" == inputStr)	TestCmdExecuter();
        else if ("09" == inputStr)	TestRingBuffer();
        else if ("10" == inputStr)	TestSetting();
        else if ("11" == inputStr)	TestComPort();
        else if ("12" == inputStr)  TestNetwork();
        else if ("13" == inputStr)  TestDataBase();
        else if ("14" == inputStr)  TestTask();
        else if ("15" == inputStr)  TestHttpClient();
        else if ("16" == inputStr)  TestJSON();
        else
        {
            ;
        }
        inputStr.clear();
    }

}